import request from '@/utils/request'

export const getSceneList = (params) => {
  return request.get('/system/scene/sceneList', { params })
}

export const getDeviceList = (params) => {
  return request.get('/system/scene/deviceList', { params })
}

export const getSensorDesc = (params) => {
  return request.get(`/system/scene/info/${params.sceneId}/${params.projectId}`)
}

export const getSelectList = (params) => {
  return request.get('/system/deviceType/select/deviceTypeList/' + params)
}

export const saveDevice = (params) => {
  return request.post('/system/scene/saveDevice', { ...params })
}

export const saveScene = (params) => {
  return request.post('/system/scene/saveScene', { ...params })
}

export const deleteDevice = (params) => {
  return request.post('/system/scene/deleteDevice?sensorInfoId=' + params)
}

export const deleteScene = (params) => {
  return request.post('/system/scene/deleteScene', {}, { params })
}

export const updateScene = (params) => {
  return request.post('/system/scene/updateScene', { ...params.params }, { params: { sceneId: params.sceneId } })
}

export const updateDevice = (params) => {
  return request.post('/system/scene/updateDevice', { ...params.params }, { params: { sensorInfoId: params.sensorId } })
}
